package com.wing.wecom.controller;

import chat.qiye.wechat.sdk.api.oa.OaApprovalApi;
import chat.qiye.wechat.sdk.api.oa.param.GetApprovalApplyNumListParam;
import chat.qiye.wechat.sdk.api.oa.param.GetApprovalDetailParam;
import chat.qiye.wechat.sdk.api.oa.param.GetApprovalTemplateParam;
import chat.qiye.wechat.sdk.api.oa.resp.ApprovalApplyNumListResp;
import chat.qiye.wechat.sdk.api.oa.resp.ApprovalDetailResp;
import chat.qiye.wechat.sdk.api.oa.resp.GetApprovalTemplateResp;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 审批
 * @author : Hui.Wang [huzi.wh@gmail.com]
 * @version : 1.0
 * @date : 2021/9/14
 */
@RestController
public class ApplyeventController {

    @Resource
    OaApprovalApi oaApprovalApi;

    /**
     * 获取审批模板详情
     * @return
     */
    @PostMapping("/applyevent/getTemplate")
    public GetApprovalTemplateResp getTemplate(GetApprovalTemplateParam getApprovalTemplateParam) {
        return oaApprovalApi.getTemplate(getApprovalTemplateParam);
    }

    /**
     * 批量获取审批单号
     * @return
     */
    @PostMapping("/applyevent/getApplyNumList")
    public ApprovalApplyNumListResp getApplyNumList(GetApprovalApplyNumListParam getApprovalApplyNumListParam) {
        return oaApprovalApi.getApplyNumList(getApprovalApplyNumListParam);
    }

    /**
     * 获取审批申请详情
     * @return
     */
    @PostMapping("/applyevent/getDetail")
    public ApprovalDetailResp getDetail(GetApprovalDetailParam getApprovalDetailParam) {
        return oaApprovalApi.getDetail(getApprovalDetailParam);
    }

}
